<!doctype html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>登录成功页面</title>
    <link rel="stylesheet" href="css/all.min.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/all.min.js"></script>
    <style>
        body {
            background: url("img/pipes.png") repeat;
        }
    </style>
    <script>
        $(function () {
            const url = window.location.href;
            const l = url.indexOf("=");
            const r = url.indexOf("+");
            if (l === -1)
                location.href = "https://yxl76.gitee.io/four_phase/login_page.html";
            const kna = url.substr(l + 1, r - l - 1);
            const pwd = url.substr(r + 1);
            const str = localStorage.getItem(kna);
            const site = JSON.parse(str);
            if (pwd !== site.pwd)
                location.href = "https://yxl76.gitee.io/four_phase/login_page.html";
            $("#sp1").html('<strong>' + '欢迎你，' + site.usn + '<strong>');
            $("#id1").html(site.usn);
            $("#id2").html(site.eml);
            $("#id3").html(site.fDate);
            $("#id4").html(site.lDate);
            const date = new Date();
            const obj = {usn: site.usn, eml: site.eml, pwd: site.pwd, fDate: site.fDate, lDate: date.toLocaleString()};
            const now = JSON.stringify(obj);
            localStorage.removeItem(kna);
            localStorage.setItem(obj.eml, now);
            $("#a1").attr("href", "https://yxl76.gitee.io/four_phase/IP_query_page.html?=" + kna + "+" + pwd);
            $("#a2").attr("href", "https://yxl76.gitee.io/four_phase/weather_query_page.html?=" + kna + "+" + pwd);
        })
    </script>
</head>

<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: Dodgerblue;">
    <span class="navbar-brand" id="sp1"></span>
    <div class="collapse navbar-collapse" id="navbarText">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                <a class="nav-link"><strong>账户信息</strong><span class="sr-only">(current)</span></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="a1"><strong>IP查询</strong></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="a2"><strong>天气查询</strong></a>
            </li>
        </ul>
        <div style="margin-right: 10px">
            <a type="button" class="btn btn-link btn-sm"
               href="https://yxl76.gitee.io/four_phase/login_page.html">注销</a>
        </div>
    </div>
</nav>
<div class="container" style="margin-top: 60px">
    <div style="text-align: center;">
        <h1><strong>兰陈昕的第三期作业</strong></h1>
        <h2><strong>欢迎你来到这</strong></h2>
    </div>
    <br>
    <br>
    <div style="width: 800px; margin: auto;">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>用户名</th>
                <th>电子邮箱</th>
                <th>注册时间</th>
                <th>上次登录时间</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td id="id1"></td>
                <td id="id2"></td>
                <td id="id3"></td>
                <td id="id4"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
</body>

</html>